-- kill_recover2
-- created by panyl
-- 击杀敌人增加属性N

return {
    apply = function(prop, baseValue)
        return baseValue + prop[3];
    end,

    -- 击杀触发
    trigger = function(who, prop, arg)

        local attrib = prop[2];
        local value  = prop[3];

        -- 获取地牢难度系数
        local dugeonId = DungeonM.getDungeonId();
        if dugeonId == nil then
            dugeonId = ME.user.dbase:query("currentDungeon");
        end
        local layerFix = DungeonAreaM.query(dugeonId, "layer_fix");

        -- 探索点需要根据公式计算
        if attrib == "search_point" then
            value = value + math.modf(value * layerFix / 64);
        end

        BonusM.doBonus({ 2, attrib, value, }, "prop kill_recover2");

        return prop[3];
    end,

    desc = function(prop)
        local row = PropM.getRow(prop[1]);
        local desc = row.desc;

        local attrib = FieldsM.getFieldName(prop[2]);
        if attrib then
            if prop[2] == "hp" or prop[2] == "mp" then
                desc = string.gsub(desc, "{0}", string.format(getLocStr("kill_recover2"), attrib));
            else
                desc = string.gsub(desc, "{0}", attrib);
            end
        end

        desc = string.gsub(desc, "{1}", prop[3]);

        return desc;
    end,

    record = function(target, prop, path)
        return false;
    end
};